package com.android.music.fragment;

import com.android.music.R;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class UsbfunctionFragment extends Fragment {

	private View mUsbFunctionView;
	private TextView output_function;
	private int usbIndex;

	public UsbfunctionFragment(int index) {
		// TODO Auto-generated constructor stub
		Bundle bundle = new Bundle();
		bundle.putInt("usbfunction", index);
		setArguments(bundle);
	}

	@Override
	public View onCreateView(LayoutInflater inflater,
			@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		usbIndex = getArguments().getInt("usbfunction", 0);

		mUsbFunctionView = inflater.inflate(R.layout.usb_function_fragment,
				container, false);
		output_function = (TextView) mUsbFunctionView
				.findViewById(R.id.output_function);

		if (usbIndex == 0) {
			mUsbFunctionView
					.setBackgroundResource(R.drawable.output_function_coax);
			output_function.setText(R.string.btn_coax);
		} else if (usbIndex == 1) {
			mUsbFunctionView
					.setBackgroundResource(R.drawable.output_function_opti);
			output_function.setText(R.string.btn_opti);
		} else if (usbIndex == 2) {
			mUsbFunctionView
					.setBackgroundResource(R.drawable.output_function_usb);
			output_function.setText(R.string.btn_usb);
		}

		return mUsbFunctionView;
	}
}
